﻿using System.Configuration;
using System.Web.Configuration;
using OpenLightGroup.Common.ApplicationServices ;
using System ;

namespace ExampleWeb
{
    public partial class _Default : System.Web.UI.Page
    {
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load ( object sender, EventArgs e )
        {
        

            EventLogger.Log<InformationEvent> ( "Info: Page Loaded", this, 0 ) ;
            
            EventLogger.Debug ( "DEBUG: Page Loaded..." ) ;

            EventLogger.LogError<ErrorEvent>
                ( new NotSupportedException ( "Oops" ) ) ;

            EventLogger.LogWarning ( "An Oops has occurred." ) ;

            EventLogger.LogError<CriticalErrorEvent>
                ( "Critical Error", this, 0, new NotSupportedException ( "Critical - Not Supported" ) ) ;

            EventLogger.Log<WarningEvent>("Warning: Errors have occurred.");

            EventLogger.Debug<DebugEvent>("DEBUG with Source: Page Loaded.", this, 0);

            EventLogger.Debug<DebugEvent>("DEBUG Event with no Source: Page Loaded.");

            try
            {
                var d = DateTime.Now.Second * 0 ;

                var x = 10 / d ;
            }
            catch (Exception ex)
            {
                EventLogger.LogError ( ex ) ;
            }

            EventLogger.LogInformation ( "Page Load completed." ) ;
        }
    }
}